package com.huobao.yunying.activitys.muyingquan;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huobao.yunying.adapters.Adapter_SheQuXiaoXi_HuiFu;
import com.huobao.yunying.https.Http;
import com.huobao.yunying.https.HttpListener;
import com.huobao.yunying.https.HttpUtil;

import android.view.View;

public class Act_SheQuXiaoXi_HuiFu extends Act_SheQu_Base {
	private Adapter_SheQuXiaoXi_HuiFu adapter;
	private List<SheQuXiaoxi> datas = new ArrayList<SheQuXiaoxi>();

	@Override
	protected void onInit() {
		mLinearLayout.setVisibility(View.GONE);
		adapter = new Adapter_SheQuXiaoXi_HuiFu(context);
		mListView.setAdapter(adapter);
		GetData();
	}

	private void GetData() {
		Map<String, String> map = HttpUtil.getParams("app", "mypost", "act", "my_news");
		Http.getInstant().sendRequest(context, true, map, new HttpListener() {

			@Override
			public void onHttpSuccess(String result) {
				JSONObject object = JSON.parseObject(result);
				datas = JSON.parseArray(object.getString("retval"), SheQuXiaoxi.class);
				if (datas == null || datas.size() == 0) {
					Rel_empty.setVisibility(View.VISIBLE);
					mListView.setVisibility(View.GONE);
				} else {
					Rel_empty.setVisibility(View.GONE);
					mListView.setVisibility(View.VISIBLE);
					adapter.addAll(datas);
				}

			}

			@Override
			public void onHttpError(String error) {

			}
		});
	}

	@Override
	protected String getTitleText() {
		// TODO Auto-generated method stub
		return null;
	}

}
